package main

import (
	"fmt"
	"time"
)

func main() {
	ch := make(chan struct{})
	go func() {
		for {
			time.Sleep(time.Second)
			<-ch
			fmt.Println("ping")
		}
	}()

	go func() {
		for {
			time.Sleep(time.Second)
			ch <- struct{}{}
			fmt.Println("pong")
		}
	}()

	time.Sleep(time.Second * 10)
}
